/**
 * 
 */
package com.luck.emp.common;

import java.sql.Types;
import java.util.HashMap;
import java.util.Map;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlOutParameter;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.StoredProcedure;

/**
 * 生成供应商编号
 *
 */
public class SpGetDefaultPosiByWhCode extends StoredProcedure {
	private final static String STORE_PROCEDURE_NAME = "PKG_WH_UTIL.WH_DEF_POSI_BY_TYPE";
	
	/**
	 * 编译存储过程
	 * @param jdbcTemplate
	 */
	public SpGetDefaultPosiByWhCode(JdbcTemplate jdbcTemplate) {
		super(jdbcTemplate, STORE_PROCEDURE_NAME);
		declareParameter(new SqlParameter("PI_WH_CODE",Types.VARCHAR));
		declareParameter(new SqlParameter("PI_AREA_TYPE",Types.VARCHAR));
		declareParameter(new SqlOutParameter("PO_POSI",Types.VARCHAR));
		compile();
	}
	
	/**
	 * 执行存储过程
	 * @param deptCode
	 * @return
	 */
	public String execute(String whCode, String areaType){
		 Map params = new HashMap();
		 params.put("PI_WH_CODE", whCode);
		 params.put("PI_AREA_TYPE", areaType);
		 Map result = super.execute(params);
		 return (String)result.get("PO_POSI");
	 }
}
